package wxact

import (
	"log"
	"time"

	"github.com/astaxie/beego/httplib"

	"myproject/wx_test/src/wxglob"
)

func GetSrvlist() {
	//https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=ACCESS_TOKEN
	url := "https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=" + wxglob.AccessToken

	//发送请求
	req := httplib.Get(url).SetTimeout(50*time.Second, 50*time.Second)

	slist := make(map[string][]string)
	err := req.ToJSON(&slist)
	if err != nil {
		log.Println(err)
		return
	}
	log.Println("server list 获取成功")

	//存入server List
	wxglob.ServerList = slist["ip_list"]
	return
}
